<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>elasticsearch</title>
</head>
<body>
    <table width="65%" cellpadding="0" cellspacing="0" border="0">
        <tr>
            <td><input type="button" id="add" value="添加"></td>
            <td><input type="button" id="addAll" value="添加集合"></td>
            <td><input type="button" id="del" value="删除"></td>
            <td><input type="button" id="list" value="查询"></td>
        </tr>
    </table>
</body>
<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript">
    $(function (){
        $('#add').click(function () {
            $.ajax({
                type: 'post', dataType: 'json', cache: false,
                url: '{:url("add")}',
                success: function ($data){
                    alert($data.message)
                },
                error: function () {
                    alert('服务器异常')
                }
            })
        })
        $('#addAll').click(function () {
            $.ajax({
                type: 'post', dataType: 'json', cache: false,
                url: '{:url("addAll")}',
                success: function ($data) {
                    alert($data.message)
                },
                error: function () {
                    alert('服务器异常')
                }
            })
        })
        $('#del').click(function () {
            $.ajax({
                type: 'post', dataType: 'json', cache: false,
                url: '{:url("del")}',
                success: function ($data) {
                    alert($data.message)
                },
                error: function () {
                    alert('服务器异常')
                }
            })
        })
        $('#list').click(function () {
            $.ajax({
                type: 'post', dataType: 'json', cache: false,
                url: '{:url("getList")}',
                success: function ($data){
                    console.log($data)
                },
                error: function () {
                    alert('服务器异常')
                }
            })
        })
    })
</script>
</html>